package com.encapsulation.exer2;

public class Account {
	private double balance;
	
	public Account(double init_balance){
		this.balance = init_balance;
	}
	public double getBalance(){
		return balance;
		
	}
	
	//存钱
	public void deposit(double amt){
		balance +=amt;
		System.out.println("存钱成功");
	}
	//取钱
	public void withdarw(double amt){
		if(amt<balance){
			balance -=amt;
			System.out.println("取了："+amt+"元钱");
		}else{
			System.out.println("余额不足");
		}
	}
}
